package de.iritgo.skillfull.component.visitor;

import de.iritgo.skillfull.component.visual.SpriteSheetRenderComponent;

/**
 * Set the height and the width in a bar component
 * 
 * @author held
 *
 */
public class BarVisitor extends BaseVisitor 
{
	private int special;
	private boolean setBar;
	private float rwidth;
	private float rheight;

	
	public BarVisitor (float rwidth, float rheight)
	{
		this.setBar = true;
		this.rwidth = rwidth;
		this.rheight = rheight;
	}
	
	public BarVisitor(int special) 
	{
		this.special = special;
	}

	public boolean isDone ()
	{
		return true;
	}

	public void visit (SpriteSheetRenderComponent spriteSheetRenderComponent)
	{
		if (special == 1)
		{
			spriteSheetRenderComponent.stopAnimation();
			return;
		}
		
		if (setBar)
		{
			spriteSheetRenderComponent.setRheight(rheight);
			spriteSheetRenderComponent.setRwidth(rwidth);
			setBar = false;
		}
	}
}
